const fs = require("fs");
const path = require("path");

const copyModule = require('./lib/copyModule') 

  // 将配置文件见和模板文件夹复制到根目录下
  let fishConfig_path = path.resolve("./fishConfig")
  fs.mkdir(fishConfig_path,0777,err => {
    if(err) {
      throw err
    } else {
        console.log('创建配置文件夹')
        let fishConfig_modeule_path = path.resolve("./fishConfig/module")
        fs.mkdir(fishConfig_modeule_path,0777,err => {
            if(err) {
                console.log('创建模板文件夹失败')
                throw err
              } else {
                console.log('创建模板文件夹module')
                fs.mkdirSync('./fishConfig/module/m1',0777)
                fs.mkdirSync('./fishConfig/module/m2',0777)
                // 将配置文件和模板文件复制到新的文件夹里
                copyModule(path.resolve("./node_modules/touch_fish_tool/lib/module/m1"),'./fishConfig/module/m1')
                copyModule(path.resolve("./node_modules/touch_fish_tool/lib/module/m2"),'./fishConfig/module/m2')
                copyModule(path.resolve("./node_modules/touch_fish_tool/lib/config"),fishConfig_path)
      
            }
        })
    }
          
  });